﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/MainForm.master" AutoEventWireup="true" CodeFile="Category.aspx.cs" Inherits="Views_Category" %>

<asp:Content ID="Content1" ContentPlaceHolderID="header" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Title" Runat="Server">
Categories
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentRight" Runat="Server">

    <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="ID" DataSourceID="sqlDsCategory" Width="100%">
        <Columns>
            <asp:TemplateField HeaderText="Image" SortExpression="Image">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Image") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Image ID="Image3" runat="server" AlternateText='<%# Eval("Title") %>' 
                        Height="100px" ImageUrl='<%# "../Images/"+Eval("Image") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Title" SortExpression="Title">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Title") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink7" runat="server" 
                        NavigateUrl='<%# "BookDetails.aspx?ID="+Eval("ID") %>' 
                        Text='<%# Eval("Title") %>'></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Author" HeaderText="Author" 
                SortExpression="Author" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="sqlDsCategory" runat="server" 
        ConnectionString="<%$ ConnectionStrings:conStr %>" 
        ProviderName="<%$ ConnectionStrings:conStr.ProviderName %>" 
        SelectCommand="SELECT Book.ID, Book.Title, Book.Author, Book.Image, Category.CategoryName FROM Book INNER JOIN Category ON Book.CategoryID = Category.ID WHERE (Book.CategoryID = @CategoryID)">
        <SelectParameters>
            <asp:QueryStringParameter Name="CategoryID" QueryStringField="ID" />
        </SelectParameters>
    </asp:SqlDataSource>

</asp:Content>

